package com.cskaoyan.controller.wx;

import com.cskaoyan.bean.bo.WxBaseParam;
import com.cskaoyan.bean.vo.BaseRespVo;
import com.cskaoyan.bean.vo.RelatedTopicVO;
import com.cskaoyan.bean.vo.TopicListVO;
import com.cskaoyan.bean.vo.WxTopicDetailVO;
import com.cskaoyan.service.TopicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: harveyliu
 * @description: 用来处理专题的controller
 * @time: 2021/7/12 9:51
 */
@RestController
@RequestMapping("wx/topic")
public class WxTopicController {

    @Autowired
    TopicService topicService;

    @RequestMapping("detail")
    public BaseRespVo getTopicDetail(Integer id) {
        WxTopicDetailVO topicDetailVO = topicService.queryMallTopicById(id);
        return BaseRespVo.ok(topicDetailVO);
    }

    @RequestMapping("list")
    public BaseRespVo getListByPageAndSize(WxBaseParam param) {
        TopicListVO listVO = topicService.queryTopicListByPageAndSize(param);
        return BaseRespVo.ok(listVO);
    }

    @RequestMapping("related")
    public BaseRespVo getRelatedTopic(Integer id) {

        RelatedTopicVO relatedTopicVO = topicService.getRelatedTopic(id);

        return BaseRespVo.ok(relatedTopicVO.getData());
    }

}
